package com.demo.service;

import com.demo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//使用@Service注解将UserService类标识为Sring中的Bean
@Service("userService")
public class UserService {
    //使用@Resource注解注入UserDao
    //@Resource(name="userMapper")
    @Autowired //依赖注入
    private UserMapper userMapper;

    public void save(){
        System.out.println("执行UserService.save()");
        this.userMapper.save();
    }
}